﻿#pragma once
#include <math.h>

class Vector
{

protected:
	float _x,_y;

public:
	Vector(void);
	Vector(const Vector &v);
	Vector(float x,float y);
	~Vector(void);

	inline Vector operator +(const Vector &v){ return Vector( _x + v._x, _y + v._y);}
	inline const Vector operator -(const Vector &v){ return Vector( _x - v._x, _y - v._y);}
	inline Vector operator -(void){ return Vector(-_x,-_y);}
	inline float operator *(const Vector &v){ return (_x*v._x + _y*v._y);}
	inline Vector operator *(float k){ return Vector(_x*k,_y*k);}
	inline friend Vector operator *(float k, const Vector &v) { return Vector(k*v._x,k*v._y);}
	inline bool operator !=(const Vector &v){ return _x != v._x || _y != v._y;};
	inline bool operator ==(const Vector &v){ return _x == v._x && _y == v._y;};
	//void operator =(const Vector &v){ _x = v._x; _y = v._y;}
	bool isZero();

	float getX();
	float getY();

	void setX(float x){ _x = x;};
	void setY(float y){ _y = y;};

	float Length();		// độ dài vector
	Vector Normalise(); //	Đưa về vector đơn vị
};

